<!DOCTYPE html>

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Attribute</title>
    <style>
        table {
            border: 1px solid;
            margin: auto;
            width: 500px;
        }

        td, th {
            text-align: center;
            border: 1px solid;
        }

        div {
            text-align: center;
            margin: 50px;
        }
    </style>
</head>
<body>

<div>
    <select id="attributeCategory">

    </select>
    <input type="text" id="id" placeholder="请输入编号">
    <input type="text" id="name" placeholder="请输入姓名">
    <input type="text" id="gender" placeholder="请输入性别">
    <input type="button" value="添加" id="btn_add">
</div>

<table id="attributeTable" border="1" style="background-color:#eeeeee;">

</table>

<button onclick="listAttribute()">你好</button>
<button onclick="getAttributeType()">属性</button>
</body>
<script>
    window.onload = listAttribute;
    let attribute = {
        attributeId: "",
        attributeCategory: "",
        attributeType: "",
        attributeLinkId: "",
        attributeValue: "",
        attributeAddValue: "",
        attributePctValue: "",
        state: ""
    }
    let attributeArr = function () {
        open("")
    }

    function listAttribute() {

        document.getElementById("attributeTable").innerHTML =
            " <th><td>属性大类</td><td>属性名</td></th>" +
            "<tr><td>aaaaa</td></tr>"
    }

    function getAttributeType() {
        let httpRequestG = new XMLHttpRequest();//第一步：建立所需的对象
        httpRequestG.open('GET', 'http://127.0.0.1:18081/spr/enum/KungFuQualityEnum', true);//第二步：打开连接  将请求参数写在url中  ps:"./Ptest.php?name=test&nameone=testone"
        httpRequestG.send();//第三步：发送请求  将请求参数写在URL中
        /**
         * 获取数据后的处理程序
         */
        httpRequestG.onreadystatechange = function () {
            let json = httpRequestG.responseText;//获取到json字符串，还需解析
            return json.data;
        };
    }


    let httpRequestP = new XMLHttpRequest();//第一步：创建需要的对象
    httpRequestP.open('POST', 'url', true); //第二步：打开连接/***发送json格式文件必须设置请求头 ；如下 - */
    httpRequestP.setRequestHeader("Content-type", "application/json");//设置请求头 注：post方式必须设置请求头（在建立连接后设置请求头）var obj = { name: 'zhansgan', age: 18 };
    httpRequestP.send(JSON.stringify(""));//发送请求 将json写入send中
</script>
</html>